<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('终端划拨记录列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label style="width: 120px;">达标阶段：</label>
                                <select name="achievementStage">
                                    <option value="1">一段达标</option>
                                    <option value="2">二段达标</option>
                                    <option value="3">三段达标</option>
                                </select>
                            </li>
                            <li>
                                <label style="width: 120px">活动名称：</label>
                                <select name="actId" >
                                    <option value="">请选择</option>
                                    <option th:each="act :${active}" th:value="${act.actId}" th:text="${act.actName}"></option>
                                </select>
                            </li>
                            <li>
                                <label style="width: 120px">检索周期：</label>
                                <select name="dateFormate" >
                                    <option value="10">按天</option>
                                    <option value="7">按月</option>
                                    <option value="4">按年</option>
                                </select>
                            </li>
                            <li>
                                <label style="width: 120px">服务商编号：</label>
                                <input type="text" name="agentNum" onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')"/>
                            </li>
                            <li class="select-time">
                                <label style="width: 120px">达标时间：</label>
                                <input type="text" name="startDate" id="startTime" class="time-input" />
                                <span>-</span>
                                <input type="text" name="endDate" id="endTime" class="time-input"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="searchTable()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "terminal/section";

        $(function() {
            var options = {
                url: prefix + "/allStatisticsList",
                modalName: "二段达标记录",
                columns: [
                {
                    field: 'DIRECTLY_UNDER_AGENTNO',
                    title: '服务商编号'
                },
                {
                    field: 'AGENT_NAME',
                    title: '服务商名称'
                },
                {
                    field: 'ACT_NAME',
                    title: '活动名称'
                },
                {
                    field: 'TOTAL',
                    title: '台数'
                },
                {
                    field: 'ACHIEVEMENT_DATE',
                    title: '达标时间'
                }]
            };
            $.table.init(options);
        });

        function searchTable(){
            var agentNum = $("[name = 'agentNum']").val();
            if (!agentNum){
                $.modal.alertWarning("请输入服务商编号");
                return false;
            };
            $.table.search();
        }
    </script>
</body>
</html>